package com.muki.succ.configuration;

import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;

/**
 * 读取配置文件
 * @author ljh_2017
 *
 */
public class ReadProperties {

	static Properties prop;

	static {
		prop = new Properties();
		InputStream in = ReadProperties.class.getResourceAsStream("/succ.properties");
		try {
			prop.load(in);
		} catch (IOException e) {
			e.printStackTrace();
		}
	}

	public static String get(String key) {
		return prop.getProperty(key);
	}

	public static String get(String...keys) {
		String propkey="";
		for(int i=0;i<keys.length;i++) {
			propkey += keys[i];
			if(i!=keys.length-1)
				propkey+=".";
		} 
		return get(propkey);
	}
	
	public static String[] getValues(String key) {
		String value = get(key);
		if(value.indexOf(',')==-1)
			return null;
		return value.split(",");
	}
}
